home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / Localization Tools / Localization using ResEdit™ 3.0 / Plugin for ODF 1 / Plugin for ODF 1.rsrc / EDL_128_Resource.FWmb next >
Encoding:
Text File  |  1996-12-11  |  2.9 KB  |  142 lines

  1. //========================================================================================
  2. //
  3. // Exploder description for 'FWmb' (ODF menu bar) resources
  4. //
  5. // Author:     Steve Crutchfield
  6. //
  7. // Copyright:  (c) 1996 by Apple Computer, Inc., all rights reserved.
  8. //
  9. //        The EDL and VDL code describing this resource type rely heavily
  10. //        on the use of class labels (four-character codes) used by
  11. //        ODF's archiver.  However, the base MenuBar object is not
  12. //        archivable and thus has no class label.  In order to preserve
  13. //        the symmetry required by ResEdit's recursive "SELF" command,
  14. //        a dummy class label ('root') is inserted at the top level of
  15. //        the menu hierarchy by a plug-in command.
  16. //
  17. //========================================================================================
  18.  
  19. ArchivableHeader();  // custom plugin routine--adds 10 bytes including 'root' tag
  20.                             // to top level of hierarchy
  21.  
  22. Define(FW_RArchivableObject)
  23. {
  24.     Word(fClassTag);
  25.     Long(fClassID);
  26.     Long(fLabel);
  27.     Word(fObjectTag);
  28.     Long(fObjectID);            
  29. }
  30.  
  31. Define(FW_RStringData)
  32. {
  33.     Word(fScriptCode);
  34.     Word(fLanguageCode);
  35.     String(fTitle, LengthWord);
  36. }
  37.  
  38. Define(FW_RMenuItem)
  39. {
  40.     Word(fIndex);
  41.     PadWord();
  42.     Long(fOwnerMenuClass);
  43.     PadWord();
  44.     Long(fOwnerMenuID);
  45. }
  46.  
  47. Define(FW_RSeparatorItem)
  48. {
  49.     Call(FW_RMenuItem);
  50. }
  51.  
  52. Define(FW_RTextItem)
  53. {
  54.     Call(FW_RMenuItem);
  55.  
  56.     Long(fCommandID);
  57.     Word(fMenuKey);
  58.     
  59.     Call(FW_RStringData);
  60. }
  61.  
  62. Define(FW_RToggleItem)
  63. {
  64.     Call(FW_RTextItem);
  65.  
  66.     // Using a list here is a workaround.  A better solution would
  67.     // be to use an Element(); however, there is no structure in
  68.     // VDL which causes all identifiers within its scope to
  69.     // apply to a sub-element rather than the containing element.
  70.     // DynamicVList performs this task for a list, so we use a
  71.     // single-element list here.  This is needed because both
  72.     // strings in a toggle item contain script and language
  73.     // code fields, which must have the same name in each case so
  74.     // that a single VDL named statement can be used to generate all
  75.     // script/language code popup menus.
  76.  
  77.     List(fAlternateItem, MenuItem, 1)
  78.     {
  79.         Word(fScriptCode);
  80.         Word(fLanguageCode);
  81.         String(fTitle, LengthWord);
  82.     }
  83. }
  84.  
  85. Define(FW_RSubMenuItem)
  86. {
  87.     Call(FW_RMenuItem);
  88.  
  89.     // Use of List is a workaround; see comment above.
  90.  
  91.     List(fSubMenu, SubMenu, 1)
  92.         SELF;  // submenu contains a pull-down menu ('pdmn')
  93. }
  94.  
  95. Switch(fLabel)
  96. {
  97.     case 'root':
  98.     {
  99.         // Un-comment the next line if you're using ODF 2.
  100.         // Call(FW_RStringData);
  101.  
  102.         List(fMenus, Menu, OneBasedCount(16))
  103.             SELF;  // root level contains list of pull-down menus
  104.     }
  105.             
  106.     case 'pdmn':
  107.     {
  108.         Word(fObjectTag);
  109.         Long(fObjectID);
  110.         
  111.         Call(FW_RStringData);
  112.  
  113.         List(fItems, Item, OneBasedCount(16))
  114.         {
  115.             Call(FW_RArchivableObject);
  116.         
  117.             Switch(fLabel)
  118.             {
  119.                 case 'txit':
  120.                 {
  121.                     Call(FW_RTextItem);
  122.                 }
  123.                 
  124.                 case 'tgit':
  125.                 {
  126.                     Call(FW_RToggleItem);
  127.                 }
  128.                                 
  129.                 case 'seit':
  130.                 {
  131.                     Call(FW_RSeparatorItem);
  132.                 }
  133.                 
  134.                 case 'suit':
  135.                 {
  136.                     Call(FW_RSubMenuItem);
  137.                 }
  138.             }
  139.         }
  140.     }
  141. }
  142.